 $(function () {
        $("#show").click(function () {
            $.post("http://localhost:8081/study/echart/findAll",function (data) {
                var dom = document.getElementById("contain");
                var myChart = echarts.init(dom);
                var scores=[];
                var persons=[];
                myChart.setOption({
                    title: {
                        text: '折线图堆叠'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data:['m301']
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        feature: {
                            saveAsImage: {}
                        }
                    }
                })
                for(var i=0;i<=data.score.length;i++){

                    scores.push(data.score[i])
                }
                for(var i=0;i<=data.person.length;i++){
                    persons.push(data.person[i])
                }
                myChart.setOption({
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data:scores
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [
                        {
                            name:'m301',
                            type:'line',
                            stack: '总量',
                            data:persons
                        }
                    ]
                })

            })
        })
    })



    $(function () {
        $("#show").click(function () {
            $.post("http://localhost:8081/study/echart/findAll",function (data) {
                var dom = document.getElementById("contai");
                var myChart = echarts.init(dom);
                var scores=[];
                var persons=[];
                myChart.setOption({
                    title: {
                        text: '柱状图'
                    },
                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data:['m301']
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        feature: {
                            saveAsImage: {}
                        }
                    }

                })
                for(var i=0;i<=data.score.length;i++){

                    scores.push(data.score[i])
                }
                for(var i=0;i<=data.person.length;i++){
                    persons.push(data.person[i])
                }
                myChart.setOption({
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data:scores
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [
                        {
                            name:'m301',
                            type:'bar',
                            stack: '总量',
                            data:persons
                        }
                    ]
                })

            })
        })
    })

    $(function () {
        $("#show").click(function () {
            $.post("http://localhost:8081/study/echart/findAll",function (data) {
                var dom = document.getElementById("conta");
                var myChart = echarts.init(dom);
                var scores=[];
                var persons=[];
                myChart.setOption( {
                    title : {
                        text: '某站点用户访问来源',
                        subtext: '纯属虚构',
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    }
                })
                for(var i=0;i<=data.score.length;i++){

                    scores.push(data.score[i])
                }
                for(var i=0;i<=data.person.length;i++){

                    persons.push({value:data.person[i],name:data.score[i]})
                }
                myChart.setOption({
                    legend: {
                    orient: 'vertical',
                        left: 'left',
                        data: scores
                },
                series : [
                    {
                        name: '访问来源',
                        type: 'pie',
                        radius : '55%',
                        center: ['50%', '60%'],
                        data:persons,
                        itemStyle: {
                            emphasis: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
                    }
                )

            })
        })
    })
